<style type="text/css">
/*
#user-nav, #net-nav {
	margin-bottom:10px;
}
#user-nav p, #net-nav p {
	float:left;
	margin-right:10px;
	font-weight:bold;
}
#user-nav p select, #net-nav p select {
	margin-left:3px;
}
#user-search, #net-search {
	float:right;
}
#user-nav button, #net-nav button {
	background: url(../img/bgbut.gif) repeat-x top left;
	font-weight: bold;
	border: 1px solid #ABABAB;
	padding: 1px 10px;
	font-size: 12px;
	cursor: pointer;
}
.page h2{
	border-bottom: 1px dotted #666;
	border-top: 1px dotted #666;
	padding: 10px 0;
	font-size: 18px;
	color: #24365d;
}
*/
</style>
<script type="text/javascript">       
    $(document).ready(function(){
        $('#search').each(function() {
            var default_value = this.value;
            $(this).focus(function() {
                if(this.value == default_value) {
                    this.value = '';
                }
            });
            $(this).blur(function() {
                if(this.value == '') {
                    this.value = default_value;
                }
            });
        });
    });
</script>

  <?php
    $CI =& get_instance();
    $CI->load->model(array('Location_model','Settings_model','Network_model',
    'Your_info_model','Home_info_model','User_political_bias_model'));
    
    /* complete/incomplete profile tabs */
    $user_location          = $CI->Location_model->get_location($this->session_user_id);
    $user_settings          = $CI->Settings_model->get_settings($this->session_user_id);
    //$user_networks          = $CI->Network_model->get_user_network($this->session_user_id);
    $user_info              = $CI->Your_info_model->get_your_info($this->session_user_id);
    $home_info              = $CI->Home_info_model->get_home_info($this->session_user_id);
    $user_political_bias    = $CI->User_political_bias_model->get_user_political_bias($this->session_user_id);
    $region_list=$CI->Location_model->get_region_by_country(224);
    ?>

<h3 class="purple">Users (<?php echo $total_user;?>)</h3> 
<hr>
    <div id="user-nav" class="clearfix">
	<form action="<?php echo site_url('admin/users/index/') ?>" id="user-sorting" method="post">
	<p>Show : 
    <select name="users_province">
	<option value="">Select Province</option>
	<?php if(!empty($region_list)): ?>
	<?php foreach($region_list as $key=>$value): ?>	
	<option <?php if($value['id'] == $region_id){ ?>selected="selected"<?php } ?> value="<?php echo $value['id']?>"><?php echo $value['name'] ?></option>
	<?php endforeach;?>
	<?php endif; ?>
	<option value="outside" <?php if ($region_id == 'outside'){?>selected="selected"<?php }?>>Outside South Africa</option>
	<option value="undefined" <?php if ($region_id == 'undefined'){?>selected="selected"<?php }?>>Undefined</option>
	</select>
    </p>
	<p>Sorting :
	<select id="order_by" name="order_by">
	<option value="alphabetical_users" <?php if ($order_by == 'alphabetical_users'){?>selected="selected"<?php }?>>Alphabetical</option>
	<option value="newest_members" <?php if ($order_by == 'newest_members'){?>selected="selected"<?php }?>>Newest Members</option>
	<option value="oldest_members" <?php if ($order_by == 'oldest_members'){?>selected="selected"<?php }?>>Oldest Members</option>
	<option value="last_login" <?php if ($order_by == 'last_login'){?>selected="selected"<?php }?>>Last Login</option>
	<option value="unactivated_users" <?php if ($order_by == 'unactivated_users'){?>selected="selected"<?php }?>>Unactivated Users</option>
	<?php
	for ($i=65; $i<= 90; $i++) {
	$x = chr($i);
	?>
	<option value="<?php echo $x; ?>" <?php if ($order_by == $x){?>selected="selected"<?php }?>><?php echo $x ?> Surname</option>
	<?php
	}
	?>
	</select>
	</p><p>
	<?php		
		$id_sort = 'id="go_list"';
		echo form_submit('go_list','Go',$id_sort);
	?></p>
	</form>
	<form action="<?php echo site_url('admin/users/index/')?>" id="user-search" method="post">
	<p><?php
        $requestSearch_ = $requestSearch == '' ? 'Search...' :  $requestSearch;
		$username_element = array(
		'name'  => 'search',
		'id'    => 'search',
		'value' => $requestSearch_);
        echo form_input($username_element);
	?></p>
	<p><?php
		$form_button = array(
		'type'=>'submit',
		'name'=>'submit',
		'value'=>'submit',
		'content'=>'GO',
		'class'=>'no',);
        echo form_button($form_button);
		?></p>
	</form>
    </div><!-- sorting -->
    <div style="clear:both"></div>
    <h2><?php echo $detailUser['username']. ' ('.$detailUser['firstname'].' '.$detailUser['surname'].')';?></h2>

    <p>Created on <?php echo date('Y/m/d', strtotime ($detailUser['created_date'])) ?> at <?php echo date('H:i', strtotime ($detailUser['created_date'])) ?>
    <?php //echo $detailUser['created_date'];?></p>
    <p>Last login on <?php echo date('Y/m/d', strtotime ($detailUser['last_login'])) ?> at <?php echo date('H:i', strtotime ($detailUser['last_login'])) ?>
    <?php //echo $detailUser['last_login'];?></p>

    <hr class="nobottom"/>

    <div class="tabs">
        <ul>
            <li>
                <a <?php if(!empty($profile_on)){?>class="on"<?php }?> href="<?php echo site_url('admin/profile'); ?>">Login</a>
            </li>
            <li>
                <?php if(empty($user_info)){?><span>Incomplete</span> <?php } ?>
                <a <?php if(!empty($your_info_on)){?>class="on"<?php }?> href="<?php echo site_url('admin/profile/your_info'); ?>">Your Info</a></li>
            <li>
                <?php if(empty($user_location)){?><span>Incomplete</span><?php }?>
                <a <?php if(!empty($location_on)){?>class="on"<?php }?> href="<?php echo site_url('admin/profile/location'); ?>">Location</a>
            </li>
            <li>
                <?php if(empty($home_info)){?><span>Incomplete</span><?php }?>
                <a <?php if(!empty($home_info_on)){?>class="on"<?php }?> href="<?php echo site_url('admin/profile/home_info'); ?>">Home Info</a></li>
            <li>
                <?php if(empty($user_political_bias)){?><span>Incomplete</span><?php }?>
                <a <?php if(!empty($political_bias_on)){?>class="on"<?php }?> href="<?php echo site_url('admin/profile/political_bias'); ?>">Politics</a></li>
            <li>
		<?php /* if(empty($user_networks)){?><span>Incomplete</span><?} */ ?>
                <a <?php if(!empty($networks_on)){?>class="on"<?php }?> href="<?php echo site_url('admin/profile/networks'); ?>">Network/s</a>
            </li>
            <li>
                <?php if(empty($user_settings)){?><span>Incomplete</span><?php }?>
                <a <?php if(!empty($settings_on)){?> class="on" <?php }?> href="<?php echo site_url('admin/profile/settings'); ?>">Settings</a>
            </li>
			<li>
                <a <?php if(!empty($content_on)){?>class="on"<?php }?> href="<?php echo site_url('admin/profile/content'); ?>">content</a></li>
            <li>
			<li>
                <a <?php if(!empty($delete_on)){?>class="on"<?php }?> href="<?php echo site_url('admin/profile/delete_account'); ?>">Act/Del</a></li>
            <li>
        </ul>
    </div><!-- tabs -->